package com.example.netty.inoutbound.review;

import com.example.netty.inoutbound.MyBateToLongDecoder2;
import com.example.netty.inoutbound.MyByteToLongDecoder;
import com.example.netty.inoutbound.MyClientHandler;
import com.example.netty.inoutbound.MyLongToByteEncoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyClientInitializer extends ChannelInitializer<SocketChannel> {


    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        // 加入一个出站的 handler 对数据进行一个编码
        pipeline.addLast(new MyLongToByteEncoder())
                .addLast(new MyByteToLongDecoder())
                .addLast(new MyClientHandler());

    }
}
